 <#include "../common/com.html"/> <@layout>

<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
<link href='${ctx}/static/assets/css/select2.css' media='all' rel='stylesheet' type='text/css'/>
<script src='${ctx}/static/assets/js/select2.min.js' type='text/javascript'></script>
<script src='${ctx}/static/assets/js/select2_locale_zh-CN.js' type='text/javascript'></script>
<script type="text/javascript">
	/**
	 * 新增
	 */
	function saveModel() {
		var id = document.getElementById("id").value;
		if (Validator.Validate(document.getElementById('form1'))) {
		} else {
			return;
		}

		url = '';
		if (id == "") {
			url = '${ctx}/hygl/save';
		} else {
			url = '${ctx}/hygl/update';
		}
		$('#form1').form('submit', {
			url : url,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(data) {
				alert(data);
				if(data.indexOf("成功")>0){
					window.location.href = '${ctx}/hygl/newModes';
				}
				
			}
		});

	}
</script>
<div class="page-content" style="overflow: hidden">
	<div class="row-fluid">
		<form class="form-horizontal" id="form1" method="post">
			<div class="span6">
				<input type="hidden" name="id" id="id">
				<div class="control-group">
					<label class="control-label">卡号:</label>
					<div class="controls">
						<input id="card" name="card" dataType="Require" msg="请输入卡号"
							type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">姓名:</label>
					<div class="controls">
						<input id="yhm" name="yhm" type="text" maxlength="8"  dataType="Require"
							msg="请输入姓名" style="min-height: 24px;" />
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">性别:</label>
					<div class="controls">
						<select id="xb" name="xb" dataType="Require" style="min-height: 24px;width:206px;">
							<option value="男">男</option>
							<option value="女">女</option>
						</select>
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">顾客生日:</label>
					<div class="controls">
						<input id="csrq" name="csrq" type="text"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',startDate:'1970-01-01'})" class="Wdate " />
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">固定电话:</label>
					<div class="controls">
						<input id="gddh" name="gddh" maxlength="12"  type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">手机:</label>
					<div class="controls">
						<input id="dh" name="dh" maxlength="13"  type="text" dataType="Require"
							msg="请输入手机号" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">微信号:</label>
					<div class="controls">
						<input id="wxh" name="wxh" maxlength="20"  type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">原始金额:</label>
					<div class="controls">
						<input id="ysje" name="ysje" onblur="funye()" class="easyui-numberbox"   dataType="Require" msg="请输入原始金额"
							type="text" style="min-height: 24px;" />
					</div>
				</div>


			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">会员卡分类:</label>
					<div class="controls">
						<input type="text"  name="hykfl" id="hykfl"  style="width: 200px; min-height: 24px;">
						<input id="ye" name="ye" type="hidden" readonly="readonly" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车型:</label>
					<div class="controls">
						<select id="cx" name="cx" maxlength="8" style="min-height: 24px;width:206px;">
							<option value="特小型">特小型</option>
							<option value="小型轿车">小型轿车</option>
							<option value="中型吉普">中型吉普</option>
							<option value="大型SUV">大型SUV</option>
							<option value="特大型车">特大型</option>
						</select>
						
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车款:</label>
					<div class="controls">
						<input id="ck" name="ck" maxlength="8"  type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车牌号1:</label>
					<div class="controls">
						<input id="cph" name="cph"   maxlength="8" dataType="Require" msg="请输入车牌号"
							type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车牌号2:</label>
					<div class="controls">
						<input id="cph2" name="cph2"   maxlength="8" dataType="Require" msg="请输入车牌号"
							type="text" value="黑B" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">保险日期:</label>
					<div class="controls">
						<input id="bxrq" name="bxrq" type="text"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate " />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">年检日期:</label>
					<div class="controls">
						<input id="njrq" name="njrq" type="text"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate " />
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">备注:</label>
					<div class="controls">
						<input id="bz" name="bz" type="text"
							style="min-height: 24px;" class="Wdate " />
					</div>
				</div>

			</div>
			<div class="span12 center">
				<a class="btn btn-info btn-small" onclick="saveModel()">确定办理 </a>
				&nbsp; &nbsp;&nbsp;&nbsp; <a
					class="btn btn-danger btn-small bigger-110"
					onclick="window.location.href=' ${ctx}/hygl/'">取消 </a>
			</div>
		</form>

	</div>
</div>

</body>

<script>
function funye(){
var ysje=	$("#ysje").val();
   $("#ye").attr("value",ysje);
}
	/**
	 * 修改页面使用
	 */
	 jQuery(function($) {
	 $('#hykfl').select2({
	        placeholder: "",
	        minimumInputLength: 0,
	        ajax: {
	            url:"${ctx}/common/comboTree/type='hykfl'?table=codes&fields=code as id,rmk as zk,name as text&pid=pid&pidStart=0&id=id"  ,
	            dataType: 'json',
	            data: function (term, page) {
	                return {
	                    term: term,
	                    page_limit: 50,
	                    page: 0,
	                    apikey: "gethykfl"
	                };
	            },
	            results: function (data, page) {
	           return { results: data};
	            }

	        }
	    });
	 
	 <#list newlist as m>
		  $("#hykfl").select2("data", {id: "${(m.hykfl)!}", text: "${(m.hykflmc)!}"});
		</#list>
	   });
	<#list newlist as m>
	document.getElementById("id").value = '${(m.id)!}';
	document.getElementById("card").value = '${(m.card)!}';
	document.getElementById("yhm").value = '${(m.yhm)!}';
	document.getElementById("xb").value = '${(m.xb)!}';
	document.getElementById("csrq").value = '${(m.csrq)!}';
	document.getElementById("bz").value = '${(m.bz)!}';
	document.getElementById("cph2").value = '${(m.cph2)!}';
	document.getElementById("gddh").value = '${(m.gddh)!}';
	document.getElementById("dh").value = '${(m.dh)!}';
	document.getElementById("wxh").value = '${(m.wxh)!}';
	document.getElementById("ysje").value = '${(m.ysje)!}';
	document.getElementById("ye").value = '${(m.ye)!}';
	document.getElementById("cx").value = '${(m.cx)!}';
	document.getElementById("ck").value = '${(m.ck)!}';
	document.getElementById("cph").value = '${(m.cph)!}';
	document.getElementById("bxrq").value = '${(m.bxrq)!}';
	document.getElementById("njrq").value = '${(m.njrq)!}';
	$("#ysje").attr("readonly","readonly");
	$("#ye").attr("readonly","readonly");
	$("#card").attr("readonly","readonly");
	</#list>
	
</script>
</@layout>
